package com.example.ssm.service.impl;

import com.example.ssm.dao.DaoFactory;
import com.example.ssm.dao.ShopDao;
import com.example.ssm.entity.Merchant;
import com.example.ssm.entity.UpComing_Shop;
import com.example.ssm.service.ShopService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.io.IOException;
import java.util.List;

@Service("ShopService")
public class ShopServiceImpl implements ShopService {



    @Override
    public void ToSubmit(UpComing_Shop UpComing_Shop) throws IOException {
        ShopDao dao= DaoFactory.getShopDao();
         dao.ToSubmit(UpComing_Shop);
    }

    @Override
    public List<UpComing_Shop> selectShop() throws IOException {
        ShopDao dao= DaoFactory.getShopDao();
        return dao.selectAllShop();
    }

    @Override
    public void insert(UpComing_Shop shop) throws IOException {
        ShopDao dao= DaoFactory.getShopDao();
         dao.insert(shop);
    }

    @Override
    public void del(String shop_name) throws IOException {
        ShopDao dao= DaoFactory.getShopDao();
         dao.del(shop_name);
    }

    @Override
    public UpComing_Shop selectByName(UpComing_Shop shop) throws IOException {
        ShopDao dao= DaoFactory.getShopDao();
        return dao.selectByName(shop);
    }

    @Override
    public Merchant select(String use_name) throws IOException {
        ShopDao dao= DaoFactory.getShopDao();
        return dao.select(use_name);
    }

    @Override
    public Merchant selectByShopName(Merchant merchant) throws IOException {
        ShopDao dao= DaoFactory.getShopDao();

        return dao.selectByShopName(merchant);
    }

    @Override
    public boolean addMoney(Merchant merchant) throws IOException {
        ShopDao dao= DaoFactory.getShopDao();
        return dao.addMoney(merchant);
    }
}
